<!DOCTYPE html>
<html>

<head lang="en">
    <title>我的视频</title>
    <meta charset="utf-8"/>
    <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
    <link rel="stylesheet" href="/js/bootstrap/css/bootstrap.css">
    <script src="/js/jquery/jquery.min.js"></script>
    <script src="/js/bootstrap/js/bootstrap.min.js"></script>
    <link rel="stylesheet" href="/css/font/css/font-awesome.min.css"/>
    <link rel="stylesheet" href="/css/reset.css"/>
    <link rel="stylesheet" href="/css/userTravels.css"/>
    <link rel="stylesheet" href="/js/plugins/jquery-confirm/css/jquery-confirm.css">
    <script src="/js/plugins/jquery-confirm/js/jquery-confirm.js"></script>
    <script src="/js/plugins/jquery-form/jquery.form.js"></script>
    <script src="/js/plugins/hivideo-master/hivideo.js"></script>
    <link rel="stylesheet" href="/js/plugins/hivideo-master/assets/hivideo.css">
    <script src="/js/plugins/jrender/jrender.js"></script>
    <link rel="stylesheet" href="/js/plugins/dialog/dialog.css">
    <script src="/js/plugins/dialog/dialog.min.js"></script>
    <script src="/js/common.js"></script>
    <style>
    </style>
</head>

<body>
<div class="search-head">
    <div class="row nav-search">
        <div class="col">
            <a href="javascript:window.history.go(-1)">
                <span><i class="fa fa-chevron-left"></i></span>
            </a>

        </div>
        <div class="col">
            <span>我的视频</span>
        </div>
        <div class="col"></div>
    </div>
</div>
<div class="container videos">
    <dl class="list" render-loop="list">
        <dd>
            <!-- 渲染a标签由于底层渲染不同的结果,需要使用函数渲染 -->
            <a href="/mine/video.html" render-key="list.id" render-fun="handle">
                <img render-src="list.imgUrl">
                <h6 class="title" render-html="list.title"></h6>
                <p>最近更新时间: <span render-html="list.time"></span>
                <p>状态: <span render-html="list.stateStr"></span>
                    <span class="span-right">
                        <i class="fa fa-video-camera"></i><span render-html="list.lookNum"></span>播放次数
                </p>
            </a>
        </dd>
    </dl>
</div>

<div id="push"></div>
</body>
<script>
    var user = sessionStorage.getItem("user");
    user = JSON.parse(user);
    var pages;
    var currentPage = 1;
    var videos;
    $.get("/users/"+ user.id + "/videos",function (data) {
        pages = data.pages;
        videos = data.list;
        $(".videos").renderValues(data,{
            handle:function (ele, value) {
                ele.href="/video.html?id=" + value;
            }
        });
    });
    $(function () {
        //设置窗口的滚到事件
        $(window).scroll(function () {
            if (isEnd()) {
                if (currentPage < pages) {
                    currentPage++;
                    var args = {currentPage: currentPage};
                    $.get("/users/"+ user.id + "/videos",args,function (data) {
                        pages = data.pages;
                        $.merge(videos, data.list);
                        $(".videos").renderValues({list:videos},{
                            handle:function (ele, value) {
                                ele.href="/video.html?id=" + value;
                            }
                        });
                    });
                } else {
                    $(document).dialog({
                        type : "notice",
                        infoText: "没了(＃°Д°)",
                        autoClose: 1500,
                        position: "bottom"
                    });
                }
            }
        });
    })
</script>

</html>